import {httpRequest} from '@/utils/http';
import { UpkeepProjectRecordVO, UpkeepProjectRecordForm, UpkeepProjectRecordQuery } from '@/api/iot/upkeepProjectRecord/types';

enum Api {
    root = '/iot/upkeepProjectRecord',
    list = '/iot/upkeepProjectRecord/list',
}
/**
 * 查询电梯保养项目记录列表
 * @param query
 * @returns {*}
 */
export function listUpkeepProjectRecord(query?: UpkeepProjectRecordQuery) {
    return httpRequest.get<UpkeepProjectRecordVO[]>({url: Api.list, data: query});
}

/**
 * 查询电梯保养项目记录详细
 * @param recordId
 */
export function getUpkeepProjectRecord(recordId: string | number) {
    return httpRequest.get<UpkeepProjectRecordVO>({url: Api.root + '/' + recordId});
}

/**
 * 新增电梯保养项目记录
 * @param data
 */
export function addUpkeepProjectRecord(data: UpkeepProjectRecordForm) {
    return httpRequest.post({url: Api.root, data});
}

/**
 * 修改电梯保养项目记录
 * @param data
 */
export function updateUpkeepProjectRecord(data: UpkeepProjectRecordForm) {
    return httpRequest.put({url: Api.root, data});
}

/**
 * 删除电梯保养项目记录
 * @param recordId
 */
export function deleteUpkeepProjectRecord(recordId: string | number) {
    return httpRequest.delete({url: Api.root + '/' + recordId});
}
